from PyQt5 import uic
from PyQt5 import uic

def get_object_names(ui_file):
    # 加载UI文件
    print("321")
    print(uic.loadUiType(ui_file))
    widget, window_base_class = uic.loadUiType(ui_file)

    print(widget)
    print(window_base_class)
    # 获取所有对象名称
    object_names = [obj.objectName() for obj in window_base_class.children()]
    # 对对象名称进行排序
    sorted_object_names = sorted(object_names)
    return "123"
 
# 假设你的UI文件是'my_form.ui'
print("123")
sorted_names = get_object_names("untitled.ui")
print(sorted_names)